package com.cljh.mapper;


import com.cljh.bean.Files;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface FileMapper {
    @Insert("insert into mtmall_test.files ( file_name, type, url, size,md5) values (#{file.fileName},#{file.type},#{file.url},#{file.size},#{file.md5});")
    int save(@Param("file") Files file);
    @Delete("delete from mtmall_test.files where id=#{id} ;")
    int delete(Integer id);

    int update(@Param("file") Files file);

    @Select("select * from mtmall_test.files;")
    List<Files> selectAll();

    @Select("select * from mtmall_test.files where id=#{id} ;")
    Files selectId(Integer id);

    @Select("select * from mtmall_test.files where md5 =#{md5} ;")
    Files selectByMd5(String md5);

    List<Files> selectAllByCondition(@Param("begin")Integer begin,@Param("size") Integer size,@Param("files")Files files);

    int count(@Param("files") Files files);


    int deleteByIds(@Param("ids") List<Integer> ids);



    List<Files> selectFiles(@Param("file") Files file);


}
